home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v17n03 / oopasm.exe / KEYBOARD.MAC < prev    next >
Encoding:
Text File  |  1990-12-15  |  1.0 KB  |  47 lines

  1. COMMENT    %
  2. ============================================================================
  3. Gets the keyboard shift status.
  4.  
  5. ===========================================================================%
  6. getShiftStatus    MACRO    Dest
  7.     mov    ah,2            ;Pass shift status function code
  8.     int    16h            ;Keyboard interrupt
  9.     IFDIF    <Dest>,<ax>
  10.     mov    Dest,ax
  11.     ENDIF
  12.     ENDM
  13.  
  14.  
  15.  
  16. COMMENT    %
  17. ============================================================================
  18. Tests wether there has been a keyboard event.
  19.  
  20. ===========================================================================%
  21. ifNoKey    MACRO    Label1,Label2
  22.     mov    ah,1
  23.     int    16h
  24.     jz    Label1
  25.     IFNB    <Label2>
  26.     jmp    Label2
  27.     ENDIF
  28.     ENDM
  29.  
  30.  
  31.  
  32. COMMENT    %
  33. ============================================================================
  34. Reads a byte from the keyboard.
  35.  
  36. ===========================================================================%
  37. readKey    MACRO    Scan,Ascii
  38.     mov    ah,0
  39.     int    16h
  40.     IFDIF    <Scan>,<ah>
  41.     mov    Scan,ah
  42.     ENDIF
  43.     IFDIF    <Ascii>,<al>
  44.     mov    Ascii,al
  45.     ENDIF
  46.     ENDM
  47.